<?php
/**
 *
 * PHP versions 4 and 5
 *
 * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
 * Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 *
 * Licensed under The MIT License
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
 * @link          http://cakephp.org CakePHP(tm) Project
 * @package       cake
 * @subpackage    cake.cake.libs.view.templates.layouts
 * @since         CakePHP(tm) v 0.10.0.1076
 * @license       MIT License (http://www.opensource.org/licenses/mit-license.php)
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <?php echo $this->Html->charset(); ?>
        <title>
            <?php echo $title_for_layout; ?>
        </title>
        <?php
            echo $this->Html->meta('icon');

            echo $this->Html->css('layout');

            echo $scripts_for_layout;
        ?>
        </head>
        <body>
            <div id="container">
                <div id="header">
    <!--                    <h1><?php echo $this->Html->link('Home', '/'); ?></h1>-->
                <?php echo $this->Html->link($this->Html->image("banner-1.jpg", array("alt" => "banner")), '/', array('escape' => false)); ?>
            </div>
            <table cellpadding="0px" cellspacing="0px">
                <tr>
                    <td class="sides">
                        <table>
                            <tr>
                                <th><?php echo $this->Html->link('Προϊόντα', '/products/search', array()) . '<br/>'; ?></th>
                            </tr>
                            <tr>
                                <td><div class="subtitle">Κατηγορίες</div></td>
                            </tr>
                            <?php
                            foreach ($cat as $c):
                            ?>
                                <tr>
                                    <td><?php echo $this->Html->link($c['Category']['name'], '/products/search/' . $c['Category']['id']); ?></td>
                                </tr>
                            <?php
                                endforeach;
                            ?>
                                <tr>
                                    <td><div class="subtitle">Κατασκευαστές</div></td>
                                </tr>
                            <?php
                                foreach ($brnd as $b):
                            ?>
                                    <tr>
                                        <td><?php echo $this->Html->link($b['Brand']['name'], '/products/search/0/' . $b['Brand']['id']); ?></td>
                                    </tr>
                            <?php
                                    endforeach;
                            ?>
                                </table>
                            </td>
                            <td>
                                <div id="content">
                            <?php echo $this->Session->flash(); ?>
                            <?php echo $content_for_layout; ?>
                                </div>
                            </td>
                            <td class="sides">
                                <table>
                                    <tr>
                                        <th>
                                    <?php
                                    if ($user == null) {
                                        echo $this->Html->link('Σύνδεση', '/users/login', array()) . '<br/>';
                                    } else {
                                        echo $this->Html->link('Αποσύνδεση', '/users/logout', array()) . '<br/>';
                                    }
                                    ?> 
                                </th>
                            </tr>
                            <tr>
                                <td>
                                    <?php
                                    if ($user == null) {
                                        echo $this->Html->link('Εγγραφή Χρήστη', '/users/register', array()) . '<br/>';
                                        ;
                                    } else {
                                        echo '<div class="subtitle">';
                                        echo 'Χρήστης: ' . $user['User']['username'];
                                        echo '</div>';
                                    }
                                    ?>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <?php
                                    echo $this->Html->link('Καλάθι Αγορών', '/carts', array()) . '<br/>';
                                    ?>
                                </td>
                            </tr>
                            <?php
                                    if ($user['User']['is_admin'] == 1) {
                                        echo '<tr><td>';
                                        echo $this->Html->link('Διαχειριστής', '/admins', array()) . '<br/>';
                                        echo '</td></tr>';
                                    }
                            ?>
                                </table>
                            </td>
                        </tr>
                    </table>
                    <div id="footer">
                <?php
                                    echo $this->Html->link(
                                            $this->Html->image('cake.power.gif', array('alt' => __('CakePHP: the rapid development php framework', true), 'border' => '0')),
                                            'http://www.cakephp.org/',
                                            array('target' => '_blank', 'escape' => false)
                                    );
                ?>
            </div>
        </div>
    </body>
</html>